<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    x:Class="OpenLS.UI.Themes.ToggleButtonResources"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                        xmlns:oui="clr-namespace:OpenLS.UI"
    xmlns:ouit="clr-namespace:OpenLS.UI.Themes"

    >
  <ResourceDictionary.MergedDictionaries>
    <ouit:ContentPresenterResources/>
    <ouit:ControlResources/>

  </ResourceDictionary.MergedDictionaries>

  <Style TargetType ="{x:Type ToggleButton}" x:Key="{x:Static oui:Styles.RibbonToggleButtonStyleKey}" BasedOn="{StaticResource ribbonControl}">
        <Setter Property ="Margin" Value="0"/>
        <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=Command, Converter={x:Static oui:OfficeConverters.CommandToTextConverter}}"></Setter>
            <Setter Property ="MinWidth" Value="{DynamicResource {x:Static oui:Sizes.SmallWidthKey}}"/>
    <Setter Property ="Background" Value ="Transparent"/>
    <Setter Property="Focusable" Value="False"/>
    <Setter Property="oui:RibbonElement.Icon">
      <Setter.Value>
        <MultiBinding Converter="{x:Static oui:OfficeConverters.CommandToIconConverter}">
          <Binding Path="Command" RelativeSource="{RelativeSource Self}"/>
          <Binding Path="(oui:RibbonElement.IconProvider)" RelativeSource="{RelativeSource Self}"/>
        </MultiBinding>
      </Setter.Value>
    </Setter>
    <Setter Property ="Content" Value="{Binding RelativeSource={RelativeSource Self}, Path=Command, Converter={x:Static oui:OfficeConverters.CommandToTextConverter}}"></Setter>
        <Setter Property ="Template">
            <Setter.Value>
                <ControlTemplate TargetType ="{x:Type ToggleButton}">
                    <Grid Background ="{TemplateBinding Background}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <ContentPresenter Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(oui:RibbonElement.Icon)}"
                                Style="{StaticResource ContentPresenterType}" Name="Icon"/>
                        <ContentPresenter Name="ContentHost" HorizontalAlignment ="Stretch" VerticalAlignment ="Stretch" Grid.Column="1"
                                     TextElement.Foreground="{DynamicResource {x:Static oui:OfficeBrushes.TextForegroundKey}}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="oui:RibbonElement.Icon" Value="{x:Null}">
                            <Setter Property ="Visibility" Value ="Collapsed" TargetName ="Icon"/>
                        </Trigger>
                        <Trigger Property="oui:RibbonElement.ControlState" Value="Small">
                            <Setter TargetName="ContentHost"  Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="oui:RibbonElement.Icon" Value="{x:Null}">
                            <Setter TargetName ="ContentHost" Property ="Visibility" Value ="Visible"/>
                        </Trigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" Value ="{DynamicResource {x:Static oui:OfficeBrushes.ButtonHoverBackgroundKey}}"/>
      </Trigger>
      <Trigger Property ="IsChecked" Value ="True">
        <Setter Property="Background" Value ="{DynamicResource {x:Static oui:OfficeBrushes.ButtonSelectedBackgroundKey}}"/>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property ="IsChecked" Value ="True"/>
          <Condition Property ="IsMouseOver" Value ="True"/>
        </MultiTrigger.Conditions>
        <Setter Property="Background" Value ="{DynamicResource {x:Static oui:OfficeBrushes.ButtonHoverSelectedBackgroundKey}}"/>
      </MultiTrigger>
      <Trigger Property ="IsPressed" Value="True">
        <Setter Property="Background" Value ="{DynamicResource {x:Static oui:OfficeBrushes.ButtonPressedBackgroundKey}}"/>
      </Trigger>
      <Trigger Property ="IsEnabled" Value="False">
        <Setter Property="Opacity" Value="0.5"/>
      </Trigger>
    </Style.Triggers>
  </Style>

</ResourceDictionary>